package org.opentcs.kcvehicle.communication.kc.udp.agv.param.function.af;

import org.opentcs.kcvehicle.communication.kc.common.byteutils.ByteUtils;

public class BatteryStatusInfo {
  //src
  private byte[] src;
  //电量百分比
  public float batteryPercentage;
  //电压
  public float voltage;
  //电流
  public float electricCurrent;
  //充电情况,1个字节
  public byte chargingState;
  //预留,7个字节
  public byte[] remain;

  public BatteryStatusInfo(byte[] src) {
    this.src = src;
    this.batteryPercentage = ByteUtils.bytesToFloat(src, 0);
    this.voltage = ByteUtils.bytesToFloat(src, 4);
    this.electricCurrent = ByteUtils.bytesToFloat(src, 8);
    this.chargingState = src[12];
    this.remain = new byte[7];
    for (int i = 0; i < 7; i++) {
      this.remain[i] = src[13 + i];
    }
  }

}
